import createLogger from 'vuex/dist/logger'

const debug = process.env.NODE_ENV !== 'production'

export const persistPaths = [
  'app.sidebar', 'app.size', 'app.theme', 'app.tagsView',
  'app.isLock', 'app.lockPasswd',
  'app.visitedViews', 'app.cachedViews',
  'app.userCenterActiveTab',
  'log.logs',
  'sys.user.userInfo', 'sys.user.token', 'sys.user.roles', 'sys.user.permissions', 'sys.user.routes', 'sys.user.routeMap', 'sys.user.routeMenus', 'sys.user.menus', 'sys.user.menu', 'sys.user.menuIndex'
]
export const getters = {
  // 全局配置
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  visitedViews: state => state.app.visitedViews,
  cachedViews: state => state.app.cachedViews,
  // 锁屏
  isLock: state => state.app.isLock,
  lockPasswd: state => state.app.lockPasswd,
  // 网站
  website: state => state.app.website,
  // 激活页面
  userCenterActiveTab: state => state.app.userCenterActiveTab,
  // 错误日志
  logs: state => state.log.logs,
  // 用户对应相关数据
  userInfo: state => state.sys.user.userInfo,
  token: state => state.sys.user.token,
  roles: state => state.sys.user.roles,
  permissions: state => state.sys.user.permissions,
  routes: state => state.sys.user.routes,
  routeMap: state => state.sys.user.routeMap,
  routeMenus: state => state.sys.user.routeMenus,
  menus: state => state.sys.user.menus,
  menu: state => state.sys.user.menu,
  menuIndex: state => state.sys.user.menuIndex
}
export const plugins = debug ? [createLogger()] : []
